package pers.lmd.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import pers.lmd.convert.ArticleConvert;
import pers.lmd.domain.dto.Article;
import pers.lmd.domain.dto.ArticleDTO;
import pers.lmd.service.IArticleService;
import pers.lmd.mapper.ArticleMapper;
import org.springframework.stereotype.Service;

/**
* @author 10149
* @description 针对表【article】的数据库操作Service实现
* @createDate 2023-05-05 23:31:25
*/
@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article>
    implements IArticleService {

    @Override
    public void addArticle(String articleImage, ArticleDTO articleDTO){
        Long id = StpUtil.getLoginIdAsLong();
        Article article = ArticleConvert.INSTANCES.toArticle(articleDTO);
        article.setImage(articleImage);
        article.setTid(id);
        save(article);
    }
}




